
<template>
  <div>
    <el-dialog
      :title="title"
      :visible="dialogVisible"
      :width="width"
      :before-close="oncancel"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
       :appendToBody="appendToBody"
    >
      <slot></slot>
      <span slot="footer" class="dialog-footer">
        <el-button @click="oncancel" v-no-click>{{ cancelName }}</el-button>
        <el-button type="primary" @click="onedit" v-no-click v-if="isedit">修改</el-button>
        <el-button type="primary" @click="onconfirm" v-no-click v-if="isShowConfirm&&!isedit">{{confirmName}}</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
export default {
  // props:[],
  props: {
        appendToBody: {
      type: Boolean,
      default: false,
    },
    dialogVisible: {
      type: Boolean,
      default: false,
    },
    width: {
      type: String,
      default: "70%",
    },
    isedit: {
      type: Boolean,
      default: false,
    },
    title: {
      type: String,
      default: "添加/编辑",
    },
    cancelName: {
      type: String,
      default: "关 闭",
    },
    confirmName: {
      type: String,
      default: "确 定",
    },
    isShowConfirm: {
      type: Boolean,
      default: true,
    },
  },
  // 页面加载
  created() {},
  // 页面加载完成
  mounted() {},
  //实例销毁之前
  beforeDestroy() {},
  //实例销毁后
  destroyed() {},
  data() {
    return {};
  },
  // 方法
  methods: {
    oncancel() {
      this.$emit("update:dialogVisible", false);
      this.$emit("oncancel");
    },
    onedit() {
      this.$emit("onedit");
    },
    onconfirm() {
      this.$emit("onconfirm");
    },
  },
  // 监听属性
  watch: {},
  // 组件
  components: {},
  // 计算属性
  computed: {},
};
</script>

<style lang="less" scoped>
</style>
